; Music of Los Inhumanos (1990) (Delta Soft)
; Ripped by Megachur the 18/04/2009

	write "LOSINHUM.BIN"

music_date_rip	equ &1249
music_adr	equ &5691
first_theme	equ 0
last_theme	equ 0	; 0 -> 0

	read "music_header_v1_0.asm"

;
.init_music_interrupt
;
	di
	call l59c7
	ld a,#00
	ld (l59c5),a
	ld hl,l56a2
	ld (#0039),hl
	ei
	ret
;
.play_music_interrupt
.l56a2
;
	di
	push af
	ld a,(l59c6)
	inc a
	ld (l59c6),a
	cp #04
	jr nz,l56d9
	xor a
	ld (l59c6),a
	push bc
	push de
	push hl
	push ix
	exx
	push af
	push bc
	push de
	push hl
	push iy
	ld a,(l59c5)
	ld b,a
	inc a
	ld (l59c5),a
	ld a,b
	and #0f
	call z,l56dc
	pop iy
	pop hl
	pop de
	pop bc
	pop af
	exx
	pop ix
	pop hl
	pop de
	pop bc
.l56d9
	pop af
	ei
	ret
;
.real_play_music
.l56dc
;
	ld a,#01
	call l5735
	ld a,#02
	call l5735
	ld a,#03
	call l5735
	ld a,(l58d2)
	ld b,a
	ld a,(l58d3)
	ld c,a
	ld a,(l58d4)
	or b
	or c
	ret z
	ld hl,l58aa
	ld b,#0e
.l56fe
	push bc
	ld a,#0e
	sub b
	ld c,(hl)
	inc hl
	call l570b
	pop bc
	djnz l56fe
	ret
.l570b
	cp #07
	jr nz,l5715
	ld b,a
	ld a,#3f
	and c
	ld c,a
	ld a,b
.l5715
	di
	ld b,#f4
	out (c),a
	ld b,#f6
	in a,(c)
	or #c0
	out (c),a
	and #3f
	out (c),a
	ld b,#f4
	out (c),c
	ld b,#f6
	ld c,a
	or #80
	out (c),a
	out (c),c
	ei
	ret
.l5735
	cp #01
	jr nz,l573e
	ld hl,(l58be)
	jr l574d
.l573e
	cp #02
	jr nz,l5747
	ld hl,(l58c0)
	jr l574d
.l5747
	cp #03
	ret nz
	ld hl,(l58c2)
.l574d
	ld (l58d1),a
.l5750
	ld a,(hl)
	cp #61
	jr c,l5759
	cp #68
	jr c,l5790
.l5759
	cp #41
	jr c,l5765
	cp #48
	jp z,l57f2
	jp c,l5796
.l5765
	cp #23
	jp z,l57fa
	cp #4f
	jp z,l5806
	cp #26
	jp z,l5814
	cp #56
	jp z,l581e
	cp #57
	jp z,l582d
	cp #58
	jp z,l583c
	cp #4d
	jp z,l5852
	cp #52
	jp z,l59c7
	jp l5814
.l5790
	sub #61
	ld b,#00
	jr l579a
.l5796
	sub #41
	ld b,#0c
.l579a
	push hl
	ld hl,l57eb
	ld d,#00
	ld e,a
	add hl,de
	ld a,(hl)
	ld c,a
	ld de,l58c7
	call l5871
	or a
	jr z,l57b0
	xor a
	ld (de),a
	inc c
.l57b0
	ld a,c
	add b
	ld c,a
	ld de,l58c4
	call l5871
	or a
	sla a
	sla a
	ld e,a
	sla a
	add e
	add c
	ld hl,l58d5
	ld d,#00
	ld e,a
	add hl,de
	add hl,de
	ld a,(hl)
	inc hl
	ld c,(hl)
	ld de,l58aa
	call l587f
	ld de,l58ca
	call l5871
	ld de,l58b2
	call l5863
	pop hl
.l57e1
	inc hl
	ld a,l
	ld c,h
	ld de,l58be
	call l587f
	ret
.l57eb
	add hl,bc
	dec bc
	nop
	ld (bc),a
	inc b
	dec b
	rlca
.l57f2
	xor a
	ld de,l58d2
	call l5863
	ret
.l57fa
	ld a,#01
	ld de,l58c7
	call l5863
	inc hl
	jp l5750
.l5806
	inc hl
	ld a,(hl)
	sub #30
	ld de,l58c4
	call l5863
	inc hl
	jp l5750
.l5814
	xor a
	ld de,l58b2
	call l5863
	jp l57e1
.l581e
	call l5890
	ld a,l
	push bc
	pop hl
	ld de,l58ca
	call l5863
	jp l5750
.l582d
	call l5890
	ld a,l
	push bc
	pop hl
	ld (l58ce),a
	ld (l58b7),a
	jp l5750
.l583c
	call l5890
	ld a,l
	ld (l58cf),a
	ld (l58b5),a
	ld a,h
	ld (l58d0),a
	ld (l58b6),a
	push bc
	pop hl
	jp l5750
.l5852
	call l5890
	ld a,l
	ld (l58cd),a
	xor #3f
	ld (l58b1),a
	push bc
	pop hl
	jp l5750
.l5863
	push bc
	push af
	ld a,(l58d1)
	ld b,a
	pop af
	dec de
.l586b
	inc de
	djnz l586b
	ld (de),a
	pop bc
	ret
.l5871
	push bc
	push af
	ld a,(l58d1)
	ld b,a
	pop af
	dec de
.l5879
	inc de
	djnz l5879
	ld a,(de)
	pop bc
	ret
.l587f
	push af
	ld a,(l58d1)
	ld b,a
	pop af
	dec de
	dec de
.l5887
	inc de
	inc de
	djnz l5887
	ld (de),a
	inc de
	ld a,c
	ld (de),a
	ret
.l5890
	push hl
	pop bc
	inc bc
	ld hl,#0000
.l5896
	ld a,(bc)
	sub #30
	cp #0a
	ret nc
	add hl,hl
	ld d,h
	ld e,l
	add hl,hl
	add hl,hl
	add hl,de
	add l
	ld l,a
	adc h
	sub l
	ld h,a
	inc bc
	jr l5896
.l58b1 equ $ + 7
.l58aa
	db #00,#00,#00,#00,#00,#00,#00,#3e
.l58b8 equ $ + 6
.l58b7 equ $ + 5
.l58b6 equ $ + 4
.l58b5 equ $ + 3
.l58b2
	db #10,#00,#00,#00,#50,#10
	dw lbe00
.l58bc equ $ + 2
.l58ba
	dw l59ed,l5af8
.l58be
	db #00,#00
.l58c2 equ $ + 2
.l58c0
	dw #0000,#0000
.l58ca equ $ + 6
.l58c7 equ $ + 3
.l58c4
	db #05,#05,#05,#00,#00,#00,#10,#00
.l58d3 equ $ + 7
.l58d2 equ $ + 6
.l58d1 equ $ + 5
.l58d0 equ $ + 4
.l58cf equ $ + 3
.l58ce equ $ + 2
.l58cd equ $ + 1
	db #00,#01,#10,#64,#64,#00,#01,#01
.l58d4
	db #01
.l58d5
	dw #34f5,#31fc,#2f2e,#2c88
	dw #2a08,#27ac,#2572,#2358
	dw #215c,#1f7d,#1db9,#1c0e
	dw #1a7a,#18fe,#1797,#1644
	dw #1504,#13d6,#12b9,#11ac
	dw #10ae,#0fbe,#0edc,#0e07
	dw #0d3d,#0c7f,#0bcb,#0b22
	dw #0a82,#09eb,#095d,#08d6
	dw #0857,#07df,#076e,#0703
	dw #069f,#0640,#05e6,#0591
	dw #0541,#04f6,#04ae,#046b
	dw #042c,#03f0,#03b7,#0382
	dw #034f,#0320,#02f3,#02c8
	dw #02a0,#027b,#0257,#0235
	dw #0216,#01f8,#01dc,#01c1
	dw #01a8,#0190,#0179,#0164
	dw #0150,#013d,#012c,#011b
	dw #010b,#00fc,#00ee,#00e0
	dw #00d4,#00c8,#00bd,#00b2
	dw #00a8,#009f,#0096,#008d
	dw #0085,#007e,#0077,#0070
	dw #006a,#0064,#005e,#0059
	dw #0054,#004f,#004b,#0047
	dw #0043,#003f,#003b,#0038
	dw #0035,#0032,#002f,#002d
	dw #002a,#0028,#0025,#0023
	dw #0021,#001f,#001e,#001c
	dw #001a,#0019,#0018,#0016
	dw #0015,#0014,#0013,#0012
	dw #0011,#0010,#000f,#000e
.l59c6 equ $ + 1
.l59c5
	db #00,#00
;
.init_music
.l59c7
;
	ld hl,(l58b8)
	ld (l58be),hl
	ld hl,(l58ba)
	ld (l58c0),hl
	ld hl,(l58bc)
	ld (l58c2),hl
	ld a,#01
	ld (l58d2),a
	ld (l58d3),a
	ld (l58d4),a
	ret
	ld a,#c9
	ld (l56a2),a
	ret
.l59ed equ $ + 2
	db #00,#00,#00,#56,#31,#36,#4f,#35
	db #45,#45,#47,#47,#47,#47,#47,#47
	db #47,#47,#47,#26,#41,#41,#47,#45
	db #44,#43,#45,#45,#45,#45,#45,#45
	db #45,#45,#45,#26,#41,#41,#47,#45
	db #44,#43,#44,#44,#44,#44,#44,#44
	db #44,#44,#44,#26,#45,#45,#44,#43
	db #61,#67,#43,#43,#43,#43,#43,#43
	db #43,#43,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#45
	db #45,#44,#43,#43,#43,#43,#46,#46
	db #46,#46,#26,#26,#26,#26,#26,#67
	db #45,#45,#43,#43,#43,#43,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#45
	db #47,#47,#47,#47,#47,#47,#47,#47
	db #47,#47,#47,#26,#41,#41,#47,#45
	db #44,#43,#45,#45,#45,#45,#45,#45
	db #45,#45,#45,#26,#41,#41,#47,#45
	db #44,#43,#44,#44,#44,#44,#44,#44
	db #44,#44,#44,#26,#45,#45,#44,#43
	db #61,#67,#43,#43,#43,#43,#43,#43
	db #43,#43,#26,#26,#4f,#36,#43,#43
	db #62,#62,#61,#61,#23,#67,#23,#67
	db #26,#23,#67,#26,#62,#62,#62,#26
	db #26,#26,#23,#67,#26,#62,#62,#62
	db #26,#26,#26,#65,#26,#43,#43,#43
	db #26,#26,#26,#65,#26,#43,#43,#43
	db #26,#26,#26,#64,#26,#43,#43,#43
	db #26,#26,#26,#64,#26,#43,#43,#43
	db #26,#26,#26,#64,#26,#62,#62,#62
.l5af8 equ $ + 5
	db #26,#26,#26,#26,#48,#00,#56,#31
	db #36,#4f,#34,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#67,#45
	db #44,#45,#46,#46,#46,#47,#45,#45
	db #45,#44,#44,#44,#44,#26,#67,#45
	db #44,#45,#45,#46,#46,#47,#41,#41
	db #41,#45,#45,#45,#45,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#67,#45,#45,#43,#43,#43
	db #43,#26,#26,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#45
	db #44,#45,#46,#46,#46,#47,#47,#45
	db #45,#44,#44,#44,#44,#26,#26,#45
	db #44,#45,#45,#46,#46,#47,#47,#41
	db #45,#45,#4f,#35,#45,#45,#44,#43
	db #43,#43,#43,#46,#46,#46,#46,#26
	db #26,#26,#26,#26,#67,#45,#45,#43
	db #43,#43,#43,#26,#26,#26,#26,#26
	db #26,#26,#26,#26,#26,#26,#26,#45
	db #45,#26,#46,#45,#45,#45,#45,#23
	db #47,#45,#45,#26,#45,#45,#45,#45
	db #26,#26,#26,#61,#61,#61,#62,#62
	db #43,#43,#43,#43,#26,#26,#26,#26
	db #26,#26,#26,#44,#44,#44,#45,#45
	db #45,#44,#44,#26,#44,#44,#44,#44
	db #26,#26,#26,#67,#62,#62,#43,#43
	db #44,#44,#44,#44,#52,#00,#00
	lbe00
	db #00,#56,#31,#36,#58,#36,#30,#30
	db #30,#57,#30,#4d,#37,#4f,#33,#47
	db #47,#63,#63,#26,#41,#47,#47,#4d
	db #31,#35,#45,#4d,#37,#47,#63,#63
	db #26,#41,#47,#47,#4d,#31,#35,#47
	db #4d,#37,#26,#63,#63,#26,#41,#47
	db #47,#4d,#31,#35,#45,#4d,#37,#47
	db #63,#63,#26,#41,#47,#47,#4d,#31
	db #35,#47,#4d,#37,#26,#46,#46,#26
	db #4f,#34,#44,#43,#43,#4d,#31,#35
	db #61,#4d,#37,#43,#66,#66,#26,#44
	db #43,#43,#4d,#31,#35,#43,#4d,#37
	db #26,#4f,#33,#63,#63,#26,#41,#47
	db #47,#4d,#31,#35,#45,#4d,#37,#47
	db #63,#26,#67,#67,#61,#61,#4d,#31
	db #35,#62,#4d,#37,#62,#63,#63,#26
	db #41,#47,#47,#4d,#31,#35,#45,#4d
	db #37,#47,#63,#63,#26,#41,#47,#47
	db #4d,#31,#35,#47,#4d,#37,#26,#63
	db #63,#26,#41,#47,#47,#4d,#31,#35
	db #45,#4d,#37,#47,#63,#63,#26,#41
	db #47,#47,#4d,#31,#35,#47,#4d,#37
	db #26,#46,#46,#26,#4f,#34,#44,#43
	db #43,#4d,#31,#35,#26,#4d,#37,#26
	db #66,#66,#26,#44,#43,#43,#4d,#31
	db #35,#26,#4d,#37,#26,#4f,#33,#63
	db #63,#26,#41,#47,#47,#4d,#31,#35
	db #45,#4d,#37,#47,#63,#63,#26,#41
	db #47,#47,#4d,#31,#35,#47,#4d,#37
	db #26,#63,#63,#26,#41,#47,#47,#4d
	db #31,#35,#45,#4d,#37,#47,#63,#63
	db #26,#41,#47,#47,#4d,#31,#35,#47
	db #4d,#37,#26,#63,#63,#26,#41,#47
	db #47,#4d,#31,#35,#45,#4d,#37,#47
	db #63,#26,#63,#63,#44,#44,#4d,#31
	db #35,#45,#4d,#37,#45,#46,#46,#26
	db #4f,#34,#44,#43,#43,#4d,#31,#35
	db #43,#4d,#37,#26,#66,#66,#26,#44
	db #43,#43,#4d,#31,#35,#43,#4d,#37
	db #26,#4f,#33,#63,#63,#26,#41,#47
	db #47,#4d,#31,#35,#45,#4d,#37,#47
	db #63,#26,#63,#63,#44,#44,#4d,#31
	db #35,#23,#44,#4d,#37,#23,#44,#45
	db #45,#26,#45,#42,#42,#4d,#31,#35
	db #42,#4d,#37,#26,#45,#45,#26,#45
	db #42,#42,#4d,#31,#35,#42,#4d,#37
	db #26,#61,#61,#26,#61,#45,#45,#4d
	db #31,#35,#45,#4d,#37,#45,#61,#26
	db #61,#61,#62,#62,#4d,#31,#35,#63
	db #4d,#37,#63,#44,#44,#26,#44,#44
	db #44,#4d,#31,#35,#44,#4d,#37,#26
	db #44,#44,#26,#44,#44,#44,#4d,#31
	db #35,#44,#4d,#37,#26,#67,#67,#26
	db #67,#67,#67,#4d,#31,#35,#67,#4d
	db #37,#26,#67,#67,#67,#26,#26,#26
	db #26,#26,#48,#00,#00
	
;
.play_music	; added by Megachur
;
	call play_music_count
	call play_music_count
	call play_music_count
	call play_music_count
	call play_music_count
;
.play_music_count
;
	ld a,(l59c6)
	inc a
	ld (l59c6),a
	cp #04
	ret nz
	xor a
	ld (l59c6),a
	ld a,(l59c5)
	ld b,a
	inc a
	ld (l59c5),a
	ld a,b
	and #0f
	call z,real_play_music
	ret
;
.game_name
	db "Los Inhumanos",0
.game_year
	db "1990",0
.game_publisher
	db "Delta Soft",0
.music_author
	db "",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
